from functools import lru_cache

from pydantic import AnyUrl
from pydantic_settings import BaseSettings


class Settings(BaseSettings):
    environment: str = "dev"
    log_level: str = "INFO"
    debug: bool = False
    testing: bool = False
    database_url: AnyUrl
    algorithm: str
    secret_key: str
    access_token_expire_days: int


@lru_cache()
def get_settings() -> Settings:
    return Settings()  # type: ignore # (https://github.com/pydantic/pydantic/issues/5190)
